
/*扫描二维码*/
var scan=null;
function onmarked( type, result ) {
	var text = '未知: ';
	switch(type){
		case plus.barcode.QR:
		text = 'QR: ';
		break;
		case plus.barcode.EAN13:
		text = 'EAN13: ';
		break;
		case plus.barcode.EAN8:
		text = 'EAN8: ';
		break;
	}
	alert( text+result );
}
var scans = document.getElementById('scan');
var cbs = document.getElementById('cbs');
var bcid = document.getElementById('bcid');
scans.onclick=function(){
	bcid.style.display="block";
	cbs.style.display="block";
	startRecognize(); 
}
cbs.onclick=function(){
	guanbi();
	bcid.style.display="none";
	cbs.style.display="none";	
}
function startRecognize() {
	scan = new plus.barcode.Barcode('bcid');
	scan.onmarked = onmarked; 
	scan.start();
}
function guanbi(){
	 scan.close();
}

var picture=document.getElementById('picture');
picture.onclick=function  () {
	captureImage();
}


function captureImage(){
	var cmr = plus.camera.getCamera();
	var res = cmr.supportedImageResolutions[0];
	var fmt = cmr.supportedImageFormats[0];
	console.log("Resolution: "+res+", Format: "+fmt);
	cmr.captureImage( function( path ){
			  
		},
		function( error ) {
			
		},
		{resolution:res,format:fmt}
	);
}

var skill=document.getElementsByClassName('mui-table-view')[0];


mui.ajax('http://www.chenbei.online/api/skill.php',{
	dataType:'json',//服务器返回json格式数据
	type:'GET',//HTTP请求类型
	timeout:10000,//超时时间设置为10秒；
	headers:{'Content-Type':'application/json'},	              
	success:function(data){
		var html = "";
		for(var i=0;i<data.length;i++){   // + data[i].name + 
            html +='<li class="mui-table-view-cell mui-media animated slideInRight">'+
					'<a href="javascript:;">'+
						'<img class="mui-media-object mui-pull-left" src="images/'+i+'.png">'+
						'<div class="mui-media-body">'+
							'<p class="mui-ellipsis" style="font-size:18px;color:red;">'+data[i].catagory+'</p>'+
							'<p class="mui-ellipsis">'+data[i].name+'</p>'+
							'<p class="mui-ellipsis">'+data[i].time+'</p>'+
							'<p class="mui-ellipsis"  style="font-size:16px;color:blue;">'+data[i].level+'</p>'+
						'</div>'+
					'</a>'+
				'</li>'
				if (i%2==0) {
						
					} else{
						
					}
        }             
        skill.innerHTML=html;	
	}		
});

var work=document.getElementsByClassName('works')[0];
mui.ajax('http://www.chenbei.online/api/work.php',{
	dataType:'json',//服务器返回json格式数据
	type:'GET',//HTTP请求类型
	timeout:10000,//超时时间设置为10秒；
	headers:{'Content-Type':'application/json'},	              
	success:function(data){
		var html = "";
		
		for(var i=0;i<data.length;i++){   // + data[i].name + 
			var num=5+i;
			var item='item'+(i+1)
			html+='<div id="'+item+'" class="mui-control-content mui-active">'	+							
						'<div class="mui-table-view" style="height:580px;">'+
							'<h4 style="line-height: 30px;"><span style="color: red;font-size: 20px;">公司名称：</span>'+data[i].name+'</h4>'+
							'<img src="images/'+num+'.jpg"/>'+
							'<p><span>公司性质：</span>'+data[i].category+'</p>'+
							'<p><span>公司网址：</span>'+data[i].url+'</p>'+
							'<p><span>工作岗位：</span>'+data[i].posts+'</p>'+
							'<p><span>工作年限：</span>'+data[i].time+'</p>'+
							'<p><span>公司人数：</span>'+data[i].peoples+'</p>'+
							'<p>'+data[i].projects+'</p>'+
							
						'</div>	'+							
					'</div>'
					
					
        }  
        
        
        
        
       
        work.innerHTML=html;	
	}		
});

var muipro=document.getElementById('pro');
mui.ajax('http://www.chenbei.online/api/project.php',{
	dataType:'json',//服务器返回json格式数据
	type:'GET',//HTTP请求类型
	timeout:10000,//超时时间设置为10秒；
	headers:{'Content-Type':'application/json'},	              
	success:function(data){
		var html = "";
		for(var i=0;i<data.length;i++){   // + data[i].name + 
            html +='<li class="mui-table-view-cell">'+
						'<div class="mui-card">'+
							'<div class="mui-card-header" style="font-size:20px">项目名称：'+data[i].name+'</div>'+
							'<div class="mui-card-content">'+
								'<div class="mui-card-content-inner" style="color:#000;font-size:16px;padding:5px 0px 0px 15px">项目类型：'+data[i].category+'</div>'+
								'<div class="mui-card-content-inner" style="color:#000;font-size:16px">项目介绍：'+data[i].description+'</div>'+
							'</div>'+
							
						'</div>'+
						
						'<div class="mui-card">'+
							'<div class="mui-card-header mui-card-media" style="height:60vw;background-image:url(images/'+i+'.jpg)"></div>'+
							'<div class="mui-card-content">'+
								'<div class="mui-card-content-inner">'+
									'<p><span>公司网址:</span>'+data[i].url+'</p>'+
									'<p><span>开发细节:</span>'+data[i].detail+'</p>'+
									'<p><span>技术:</span>'+data[i].tech+'</p>'+
								'</div>'+
							'</div>'+
							
						'</div>'+
					'</li>'
        }             
        muipro.innerHTML=html;	
	}		
});







